#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>

int main()
{
    printf("我是父进程:%d\n", getpid());

    pid_t id = fork();
    if (id == 0)
    {
        while(1)
        {
            printf("我是子进程:%d,我的父进程:%d\n", getpid(), getppid());
            sleep(1);
        }
    }
    else
    {
        while(1)
        {
            printf("我是父进程:%d\n", getpid()); 
            sleep(1);
        }
    }

    //int a = 10;
    //scanf("%d", &a);
    //printf("%d\n", a);
    //while(1)
    //{
    //    printf("hello world\n");
    //    sleep(1);
    //}

    //return 0;

    //while(1)
    //{

    //}
}
